package com.example.zhanglinan.vrdemo.fragment;

import android.app.Fragment;
import android.graphics.ImageFormat;
import android.os.Bundle;
import android.support.annotation.Nullable;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.AdapterView;
import android.widget.ArrayAdapter;
import android.widget.ListView;
import android.widget.Toast;

import com.example.zhanglinan.vrdemo.R;


/**
 * @author Schutzengel
 *         o(＞﹏＜)o
 *         create on 2017/1/27 13:48
 *         $desc$
 */
public class NaviFragment extends Fragment {

    @Nullable
    @Override
    public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
        View view = inflater.inflate(R.layout.fragment_navi, container, false);
        ListView lvNavi = (ListView) view.findViewById(R.id.lv_navi);
        String[] strings = {"1", "2", "3"};
        lvNavi.setAdapter(new ArrayAdapter<>(getActivity(),
                android.R.layout.simple_expandable_list_item_1,
                strings));
        lvNavi.setOnItemClickListener(new AdapterView.OnItemClickListener() {
            @Override
            public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
                if (getActivity() != null) {
                    Toast.makeText(getActivity(), position + 1+"", Toast.LENGTH_SHORT).show();
//                getActivity().onOptionsItemSelected()
                }
            }
        });
        return view;
    }
}
